<template>
  <div>
    <el-tag :type="state.type" v-if="renderRow.isSuspend !== null">{{
      state.statusDict[renderField.prop as any][renderRow.isSuspend]
    }}</el-tag>
  </div>
</template>
<script lang="ts" setup>
import { ref, onMounted, reactive, inject } from "vue";
import type { TableColumn, TableRow, OptButton } from "@/utils/baTable"; //表格列行类型
import { CollectionTag } from "@element-plus/icons-vue";

const dictionary = inject("dictionary") as any;

// BuildAdmin将自动为此组件传递五个Props
interface Props {
  renderValue: any; // 单元格值
  renderRow: TableRow; // 当前行数据
  renderField: TableColumn; // 当前列数据
}

const props = withDefaults(defineProps<Props>(), {});

const state: { statusDict: anyObj; type: string } = reactive({
  statusDict: dictionary.moreTags,
  type:
    dictionary.moreTags[props.renderField.prop as any][
      props.renderRow.isSuspend
    ] === "是"
      ? "success"
      : "danger",
});

onMounted(() => {
  // console.log(
  //   "TagVue单元格值",
  //   dictionary.moreTags,
  //   props.renderRow.isSuspend,
  //   props.renderField.prop,
  //   state.statusDict[props.renderField.prop as any][props.renderRow.isSuspend]
  // );
});
</script>
<style lang="scss" scoped></style>
